The differences between classic and modern WebScript syntax are summarized below:
Classic:
- submit {
// <body>
}
Modern:
function submit() {
// <body>
}
Classic:
- takeValuesFromRequest:(WORequest *)request
inContext:(WOContext *)context {
// <body>
}
Modern:
//Note: no static typing allowed.
function takeValues(fromRequest:= request inContext:= context){
// <body>
}
Classic:
[self doIt];
Modern:
self.doIt();
Classic:
[guests addObject:newGuest];
Modern:
guests.addObject(newGuest);
Classic:
[guests insertObject:newGuest atIndex:anIndex];
Modern:
guests.insert(object := newGuest, atIndex := anIndex);
super.takeValuesFrom(request := request, inContext := context);If you choose to use modern WebScript, there is another important caveat: You cannot have methods with variable-length argument lists. Thus, you cannot use methods such as logWithFormat: and stringWithFormat:. You can, however, mix classic and modern WebScript in the same script file.
super.takeValues(fromRequest := request, inContext := context);
super.take(valuesFromRequest := request, inContext := context);
Table of Contents
Next Section